<template>
  <view class="verification-counter">
    <u-overlay
      class="show_overlay"
      :show="showVerifyModal"
      @click="overlayClick"
      :duration="350"
    ></u-overlay>

    <u-transition
      :show="showVerifyModal"
      mode="fade"
      :duration="300"
      :customStyle="transitionStyle"
      class="show_transition"
    >
      <view class="modal_content">
        <view class="top-triangle"></view>
        <slot></slot>
      </view>
    </u-transition>
  </view>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    coordinate: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {};
  },
  computed: {
    showVerifyModal: {
      get() {
        return this.show;
      },
      set(val) {
        this.$emit("update:show", val);
      },
    },
    transitionStyle() {
      const style = {
        zIndex: 1000,
        position: "fixed",
      };
      return uni.$u.deepMerge(style, {
        right: this.coordinate.X,
        top: this.coordinate.Y,
      });
    },
  },
  mounted() {},
  methods: {
    overlayClick() {
      this.showVerifyModal = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.verification-counter {
  flex: 1;
  .show_transition {
    z-index: 10075 !important;
  }
  .modal_content {
    min-height: 400upx;
    background: #fff;
    z-index: 10076;
    padding: 40rpx 32rpx 32rpx;
    box-sizing: border-box;
    border-radius: 8rpx;
    position: relative;
    .top-triangle {
      border-top: 12rpx solid transparent;
      border-left: 12rpx solid transparent;
      border-right: 12rpx solid transparent;
      border-bottom: 12rpx solid #fff;
      position: absolute;
      right: 10rpx;
      top: -20rpx;
    }
  }
}
</style>
